<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加新用户</title>
</head>
<body>
<script type="text/javascript">

	function InforCheck(){
		
		//验证联系人名称是否为空
		if(!document.getElementById("username").value){
			window.alert("请输入联系人名称");
			return false;
		}
		
		//验证联系人家庭住址是否为空
		if(!document.getElementById("address").value){
			window.alert("请输入联系人家庭住址");
			return false;
		}
		
		//验证联系人手机号码是否为空
		if(!document.getElementById("phone").value){
			window.alert("请输入联系人手机号码");
			return false;
		}
		
		//验证动物价格是否为空
		if(!document.getElementById("email").value){
			window.alert("请输入联系人邮箱");
			return false;
		}else{
			var email=document.getElementById("email").value;
			if(strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
				return true;
			}
			else{
				window.alert("请输入正确的邮箱格式");	
				return false;
			}
		}
		return true;
		
	}

</script>
<center>
<form action="AddUser" method="post" onsubmit="return InforCheck()">
<h1 align="center">添加新的记录</h1>
<table height="200px" border="2" bgcolor="white" cellspacing="0" cellpadding="30px" align="center" style="margin:0px auto;">
		<tbody>
		<tr>
		<td>联系人的名称：</td>
		<td>
		<input type="text"  name="username" id="username">
		</td>
		</tr>
		
		<tr>
		<td>联系人的性别：</td>
		<td>
		<select name="Sex" id="Sex" >
		<option>男</option>
		<option>女</option>
		</select>
		</td>
		</tr>
		
		<tr>
		<td>联系人的家庭住址：</td>
		<td>
		<input type="text" name="address" id="address">
		</td>
		</tr>
		
		<tr>
		<td>联系人的手机号码：</td>
		<td>
			<input type="text" name="phone" id="phone">
		</td>
		</tr>
		
		<tr>
		<td>联系人的邮箱：</td>
		<td>
		<input type="text" name="email" id="email">
		</td>
		</tr>

		<tr>
		<td colspan="2" align="center">
		<input type="submit" name="submit" value="添加新的联系人" >
		</td>
		</tr>
		
		</tbody>
	</table>

</form>
</center>
</body>
</html>